package datastructure.sort;

public class QuickSort {

	protected int[] a;

	void recursiveQuickSort(int left, int right) {
		if (right - left <= 0) {
			return;
		} else {
			int pivot = a[right];
			int partition = partitionIt(left, right, pivot);
			recursiveQuickSort(left, partition - 1);
			recursiveQuickSort(partition + 1, right);
		}
	}

	
	int partitionIt(int left, int right, int pivot) {
		int leftptr = left - 1;
		int rightPtr = right + 1;
		while (true) {
			while (leftptr < right && a[++leftptr] < pivot);
			while (rightPtr > left && a[--rightPtr] > pivot);
			if (leftptr >= rightPtr)
				break;
			else
				swap(leftptr, rightPtr);
		}
		return leftptr;
	}

	protected void swap(int one, int two) {
		
	}

	
	// main method ...
	public static void main(String[] args) {

	}

}
